<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        debugger
        window.val = 1;
        var json = {
            val: 10,
            exec: function (fn) {
                this.val = this.val + val + fn(val);
            }
        };
        var fn = (function (val) {
            return function () {
                return val * 2 + this.val;
            };
        })(4);
        json.exec(fn);
        alert = window.val + json.val;
    </script>
</body>

</html>